How to fix mysql error 2026

您所在的位置:网站首页 ubuntu 20 How to fix mysql error 2026

How to fix mysql error 2026

#How to fix mysql error 2026| 来源: 网络整理| 查看: 265

MySQL ERROR 2026 is a common error that occurs when trying to establish an SSL connection between the client and the server. This error is caused by a number of factors, including a misconfigured server, an outdated certificate, or incorrect SSL settings on either the client or the server.

Method 1: Update Certificate

To fix the MySQL ERROR 2026 - SSL connection error in Ubuntu 20.04, you can update the SSL certificate. Here are the steps to do it:

Download the latest SSL certificate from the MySQL website: wget https://dev.mysql.com/get/Downloads/MySQLGUITools/mysql-ssl-ca-cert.pem Move the downloaded SSL certificate to the MySQL configuration directory: sudo mv mysql-ssl-ca-cert.pem /etc/mysql/certs/ Open the MySQL configuration file: sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf Add the following lines to the configuration file: ssl-ca=/etc/mysql/certs/mysql-ssl-ca-cert.pem ssl-cert=/etc/mysql/certs/server-cert.pem ssl-key=/etc/mysql/certs/server-key.pem

Save and close the configuration file.

Restart the MySQL service:

sudo service mysql restart

Now, you should be able to connect to MySQL with SSL enabled without getting the SSL connection error.

Method 2: Verify SSL Settings on Server and Client

To fix the MySQL ERROR 2026 SSL connection error on Ubuntu 20.04, you can verify the SSL settings on both the server and client. Here are the steps to do so:

Check the SSL settings on the server side: $ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

Add the following lines to the [mysqld] section:

ssl-ca=/etc/mysql/ssl/ca-cert.pem ssl-cert=/etc/mysql/ssl/server-cert.pem ssl-key=/etc/mysql/ssl/server-key.pem

Save and close the file. Then, restart the MySQL service:

$ sudo systemctl restart mysql Check the SSL settings on the client side: $ mysql --ssl-ca=/etc/mysql/ssl/ca-cert.pem --ssl-cert=/etc/mysql/ssl/client-cert.pem --ssl-key=/etc/mysql/ssl/client-key.pem -u root -p

Enter your MySQL root password when prompted. If you can successfully connect to the MySQL server, then the SSL settings on both the server and client are correct.

If you still encounter the MySQL ERROR 2026 SSL connection error, you can try the following:

Check the SSL version: $ mysql --ssl-version=TLSv1.2 -u root -p

If you can successfully connect to the MySQL server with a specific SSL version, then you can add the following line to the [mysqld] section of the /etc/mysql/mysql.conf.d/mysqld.cnf file:

ssl-cipher=TLSv1.2

Save and close the file. Then, restart the MySQL service:

$ sudo systemctl restart mysql Check the firewall settings: $ sudo ufw allow mysql

This will allow incoming MySQL connections through the firewall.

If none of the above steps work, you can try disabling SSL altogether by commenting out the SSL lines in the /etc/mysql/mysql.conf.d/mysqld.cnf file and restarting the MySQL service:

#ssl-ca=/etc/mysql/ssl/ca-cert.pem #ssl-cert=/etc/mysql/ssl/server-cert.pem #ssl-key=/etc/mysql/ssl/server-key.pem$ sudo systemctl restart mysql

Note that disabling SSL is not recommended for production environments, as it can compromise the security of your MySQL server.

Method 3: Check for misconfigured server

To fix the MySQL ERROR 2026 - SSL connection error in Ubuntu 20.04, you can try checking for a misconfigured server. Here are the steps to follow:

First, check if SSL is enabled on your MySQL server by running the following command:

mysql -u root -p -e "SHOW VARIABLES LIKE '%ssl%';"

This will show you the current SSL settings on your MySQL server.

If SSL is enabled, check if the SSL certificate is valid by running the following command:

openssl verify /etc/mysql/ssl/server-cert.pem

This will verify the SSL certificate and show you any errors.

If the SSL certificate is valid, check if the SSL CA certificate is trusted by running the following command:

openssl verify /etc/mysql/ssl/ca-cert.pem

This will verify the SSL CA certificate and show you any errors.

If there are no errors with the SSL certificate and CA certificate, check if the SSL key file is readable by the MySQL server by running the following command:

sudo chmod 400 /etc/mysql/ssl/server-key.pem

This will set the correct permissions on the SSL key file.

Finally, restart the MySQL server to apply the changes by running the following command:

sudo service mysql restart

This will restart the MySQL server with the new SSL settings.

By following these steps, you should be able to fix the MySQL ERROR 2026 - SSL connection error in Ubuntu 20.04 by checking for a misconfigured server.

Method 4: Disable SSL in MySQL Configuration

To disable SSL in MySQL Configuration, follow these steps:

Open the MySQL configuration file using your preferred text editor. For example, using nano: sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf Find the [mysqld] section and add the following line: skip_ssl=1

Save and close the file.

Restart the MySQL service:

sudo service mysql restart

With SSL disabled, you should now be able to connect to MySQL without encountering the SSL connection error.

Note: Disabling SSL may not be the most secure option, so it is recommended to use SSL whenever possible.

Here is an example of the [mysqld] section with the skip_ssl option added:

[mysqld] # # user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock skip_ssl = 1


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3